﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseSet.Data;
using BaseSet.Logic;
using BaseSet.Entity;
using BaseSet.Framework;
using BaseSet.Entity.Common;
using BaseSet.Entity.Common.Text;
using BaseSet;
using System.Data;
namespace WebSite.Admin.SystemSet
{
    public partial class SuggestionList : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadContent(false);

                // 从BasePage中得到
                PageLiteral.Text = BuildPageLinks();
            }
        }


        #region 加载列表
        private void LoadContent(bool mark)
        {

            //设置控件属性，从BasePage中得到
            PageConfig(SuggestionUPager);


            //List<Member> list = new List<Member();
            SuggestionHelper shelper = new SuggestionHelper();

            SuggestionUPager.ItemCount = shelper.QuerySuggestionCountByAll();

            // 以下的值从BasePage中得到
            SuggestionUPager.UrlFormat = UrlFormat;
            SuggestionUPager.PrefixText = GetPreFixText(SuggestionUPager);

            if (mark)
            {
                PagerInit(SuggestionUPager);
            }

            string[] fields = new string[] { "ID", "SuggestionContent", "CreateDate" };

            DataTable dt = new DataTable();
            dt = shelper.QuerySuggestionBySearchToTable(null, new Order[] { new Order("CreateDate",OrderMode.Desc) }, SuggestionUPager.Begin - 1, SuggestionUPager.Count, fields);

            rptSuggestion.DataSource = dt;
            rptSuggestion.DataBind();
        }
        #endregion
    }
}